package com.china08.yxyapi.service.yxyresource;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchQueryBuilder.Type;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.china08.yxyapi.api.manage.tec.teaching.resource.myCollect.MyCollectSrhController.RespModel;
import com.china08.yxyapi.api.manage.tec.teaching.resource.myresource.ResourceUploadController.ResourceReqModel;
import com.china08.yxyapi.entity.es.ElasticYxyResResource;
import com.china08.yxyapi.model.resource.SearchResourceModel;

public interface YxyResourceService {

    /** 审核资源 */
    void audit(Integer auditStatus, String[] ids, String content, String userId, String userNick, String schoolId,
            String schoolName);

    /** 根据ID获取资源 */
    ElasticYxyResResource findById(String id);

    /** 根据ID集合获取资源 */
    List<ElasticYxyResResource> findByIds(List<String> id);

    /** 资源查询返回集合 */
    List<ElasticYxyResResource> getList(BoolQueryBuilder boolQueryBuilder);

    /** 资源查询返回全部集合 */
    List<ElasticYxyResResource> getAll(BoolQueryBuilder boolQueryBuilder);

    /** 资源查询分页Page */
    Page<ElasticYxyResResource> getPage(BoolQueryBuilder boolQueryBuilder, Pageable pageable);

    /** 资源首页 区域推荐 */
    List<ElasticYxyResResource> homeIndexResourceRecommendArea(String domain, String bookContent, String book);

    /** 资源首页 本校推荐 */
    List<ElasticYxyResResource> homeIndexResourceRecommendSchool(String schoolId, String bookContent, String book);

    /** 资源首页 云校推荐 */
    List<ElasticYxyResResource> homeIndexResourceRecommendYun(String bookContent, String book);

    /** 资源首页 区域资源 */
    Page<ElasticYxyResResource> homeIndexResourceArea(String areaId, Integer resType, String phase, String subject,
            String version, String bookcontent, String semester, String bookId, String type, String format,
            String keyword, Type typeSearch, Pageable pageable);

    /** 资源首页 本校资源 */
    Page<ElasticYxyResResource> homeIndexResourceSchool(String schoolId, Integer resType, String phase, String subject,
            String version, String bookcontent, String semester, String bookId, String type, String format,
            String keyword, Type typeSearch, Pageable pageable);

    /** 资源首页 云校资源 */
    Page<ElasticYxyResResource> homeIndexResourceYun(Integer resType, String phase, String subject, String version,
            String bookcontent, String semester, String bookId, String type, String format, String keyword,
            Type typeSearch, Integer flag, Integer restype, Pageable pageable);

    /** 学校管理员 查询资源 */
    Page<ElasticYxyResResource> manageSchPlatform(String schoolId, Integer status, String phase, String subject,
            String keyword, Pageable pageable);

    /** 老师 查询资源 */
    Page<ElasticYxyResResource> manageTeaReachingMyResource(String userId, String schoolId, Integer viewScorp,
            Integer status, String phase, String subject, String keyword, Pageable pageable);

    /** 查询收藏资源 */
    Page<RespModel> myResourceFavor(String userId, String schoolId, String phase, String subject, String keyword,
            String role, Pageable pageable) throws IllegalAccessException, InvocationTargetException;

    /** 取消我的收藏 */
    void removeMyResourceFavor(List<String> resIds, String userId, String schoolId, String role);

    /** 资源增加下载量 */
    void resDownLoadNumberPlus(String id);

    /** 更改资源分享范围 */
    void updResViewScope(String[] ids, Integer viewScope, String userId);

    /** 老师修改自己 **/
    void teaUpdResource(String userId, String resId, String typeId, String intro, List<String> bookContentNew);

    /** 老师删除我的资源 */
    void delRes(String[] ids, String userId);

    /** 上传多个资源 */
    void addRes(Integer viewScope, String userId, String userNick, String schoolId, String schoolNick,
            List<String> bookContent, String intro, List<ResourceReqModel> resourcemodels, String provinceCode,
            String cityCode, String districtCode);

    /** 判断是否收藏 */
    long checkFavor(String userId, String schoolId, String role, String resId);

    List<ElasticYxyResResource> homeIndexNewResourceTop(String areaId, int size);

    List<ElasticYxyResResource> getListTop(BoolQueryBuilder boolQueryBuilder, int size, String order);

    List<ElasticYxyResResource> homeIndexResourceTop(String areaId, int size);

    List<ElasticYxyResResource> findByMd5(String md5);

    /**
     * 搜索资源数量
     * 
     * @param searchResourceModel
     * @return
     */
    long resourceNum(SearchResourceModel searchResourceModel);

    BoolQueryBuilder keyword(String keyword, Integer type, BoolQueryBuilder builder);

    List<ElasticYxyResResource> getRecommendResource(List<Integer> knowIds);

    Page<ElasticYxyResResource> getPageEs(BoolQueryBuilder maxBoolQueryBuilder, String keyword, Pageable pageable);

	List<ElasticYxyResResource> getResource(List<String> bookcontent);

}
